package com.cml.dm.admin.event;

import com.cml.dm.engine.detector.BRStatusDetector;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class BRNoticeEventListener {

    @Autowired
    private BRStatusDetector brStatusDetector;

    @EventListener(BRNoticeEvent.class)
    public void process(BRNoticeEvent event){
        if(event.getStatus() == BRNoticeEvent.Status.BEGIN){
            brStatusDetector.saveStatus(event.getOrgId());
            return;
        }
        brStatusDetector.removeStatus(event.getOrgId());
    }
}
